using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using Helper;
namespace CoreData
{
    public class Inventory
    {
            public long ID{get;set;}
            public string InventoryNo{get;set;}
            public DateTime InventoryDate{get;set;}
            public long StaffID{get;set;}
            public long RoomID{get;set;}
            public string Note { get; set; }
         
        public Inventory()
        {       
             InventoryNo ="";   
        }
        
       static Inventory DynamicCast<T>(object row_data, object row_header) where T : Inventory
       {
           // row_data : DataRow
           // row_header : DataColumnCollection
           Inventory ret = new Inventory();
           DataRow dt = (DataRow)row_data;

           foreach (DataColumn column in (DataColumnCollection)row_header)
           {
               switch (column.ColumnName)
               {
                      case  "ID":
                        ret.ID = ConvertObject.ToLong(dt[column]);
                       break;
                      case  "InventoryNo":
                        ret.InventoryNo = ConvertObject.ToString(dt[column]);
                       break;
                      case  "InventoryDate":
                        ret.InventoryDate = ConvertObject.ToDateTime(dt[column]);
                       break;
                      case  "StaffID":
                        ret.StaffID = ConvertObject.ToLong(dt[column]);
                       break;
                      case  "RoomID":
                        ret.RoomID = ConvertObject.ToLong(dt[column]);
                       break;
                      case "Note":
                       ret.Note = ConvertObject.ToString(dt[column]);
                       break;
                   default:
                       break;
               }
           }

           return ret;
       }
        
    }
}
